package com.nbot.server.workers;

import com.nbot.server.domain.ImportantexecuteDO;
import com.nbot.server.domain.Point;
import org.jinterop.dcom.common.JIException;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.net.UnknownHostException;
import java.util.List;
import java.util.concurrent.Future;

/**
 *
 */
@Component
public interface DbWorker {
    /**
     * 保存数据
     */
    @Async("myTaskAsyncPool")
    public void save();

    /**
     * 读取数据库
     *
     * @param key
     */
    @Async("myTaskAsyncPool")
    public void read(String key);

    @Deprecated
    public String getTagFormDesc(String descString);

    /**
     * 根据测量点的描述文字返回测量点对象，模糊匹配，= 'searchdesc'
     * @param searchdesc
     * @return
     */
    public Point getTagFormSearchdesc(String searchdesc);

    /**
     * 获取同位置的相关信息
     *
     * @param weiZhi
     * @return
     */
    List<Point> getSaveWeizhiPoint(String weiZhi);

    /**
     * 根据测量点的描述文字返回测量点对象，模糊匹配，like '%descString%'
     *
     * @param descString
     * @return String
     */
    public Point getPointFormDesc(String descString);

    /**
     * 根据测量点的描述文字返回测量点的tag（key） 异步方法
     *
     * @param descString
     * @return
     */
    @Async("myTaskAsyncPool")
    public Future<String> getTagFormDescAsync(String descString);

    /**
     * 保存重点督办数据 wyzc
     */
    @Async("myTaskAsyncPool")
    public void saveIEC(ImportantexecuteDO Date);

    /**
     * 更新重点督办数据 wyzc
     */
    @Async("myTaskAsyncPool")
    public void updateIECByKey(ImportantexecuteDO Date);

    /**
     * 查询重点督办数据 wyzc
     * 查询 不可以 @Async("myTaskAsyncPool")
     */
    public ImportantexecuteDO selectIECByKey(Long key);

    /**
     * 检查数据库中到时任务
     *
     * @return
     * @throws JIException
     * @throws UnknownHostException
     */
    public void checkIEC() throws JIException, UnknownHostException;

    /**
     * 报警数据备份转化
     *
     * @return
     * @throws JIException
     * @throws UnknownHostException
     */
    public void checkLogTrans() throws JIException, UnknownHostException;

}
